using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using SOEI.Solution.Application.Contracts.CommonOthers.BarCode.Mapper;
using SOEI.Solution.Application.Contracts.CommonOthers.Pdf.Mapper;
using SOEI.Solution.Application.Contracts.CommonOthers.WaterImage.Mapper;
using SOEI.Solution.Authorization;
using SOEI.Solution.CustomDtoAutoMapper;
using SOEI.Solution.Integratedes.Organization.Mapper;

namespace SOEI.Solution.Application.Contracts
{

    public class ApplicationContractsModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.Authorization.Providers.Add<RoomVerifyApplyAuthorizationProvider>();

            Configuration.Authorization.Providers.Add<BuyerAuthorizationProvider>();   //客源管理-买方

            Configuration.Authorization.Providers.Add<SellerAuthorizationProvider>();  //客源管理-卖方

            Configuration.Authorization.Providers.Add<BuyQualificationAuthorizationProvider>();    //购资审核

            Configuration.Authorization.Providers.Add<BuyQualificationApplyAuthorizationProvider>();

            Configuration.Authorization.Providers.Add<PurQualificationApplyAuthorizationProvider>();  //购资审核申请

            Configuration.Authorization.Providers.Add<PurFamilyMemberAuthorizationProvider>();         //购资审核申请家庭成员信息     

            Configuration.Authorization.Providers.Add<RoomVerifyPropertyAuthorizationProvider>();

            Configuration.Authorization.Providers.Add<RoomVerifyV1AuthorizationProvider>();//房源核验v1

            Configuration.Authorization.Providers.Add<LicensesUploadAuthorizationProvider>();//证照上传

            Configuration.Authorization.Providers.Add<CommissionContractDigestAuthorizationProvider>();//委托代理合同摘要

            Configuration.Authorization.Providers.Add<CommissionContractMainBodyAuthorizationProvider>();//委托代理合同正文

            Configuration.Authorization.Providers.Add<TransactionManagementAuthorizationProvider>();///房产交易进度
            // 自定义AutoMapper类型映射
            // 如果没有这一段就把本所有代码复制上去
            Configuration.Modules.AbpAutoMapper().Configurators.Add(configuration =>
            {
                // ....其他代码
                // 只需要复制这一段
                //CompanyDtoAutoMapper.CreateMappings(configuration);
                //DemoEntityDtoAutoMapper.CreateMappings(configuration);
                // ....其他代码


                // 处理领域实体之间的转换
                OrganizationCoreAutoMapper.CreateMappings(configuration);


                RoomVerifyDtoAutoMapper.CreateMappings(configuration);
                RoomVerifyApplyDtoAutoMapper.CreateMappings(configuration);

                #region 客源管理相关

                BuyerDtoAutoMapper.CreateMappings(configuration);
                SellerDtoAutoMapper.CreateMappings(configuration);

                #endregion   

                #region 经济机构
                OEconomyOrganiDtoAutoMapper.CreateMappings(configuration);
                OEconomyPersonDtoAutoMapper.CreateMappings(configuration);
                EconomyOrganiDtoAutoMapper.CreateMappings(configuration);
                OrganiPersonDtoAutoMapper.CreateMappings(configuration);
                OEconomyPersonChangeDtoAutoMapper.CreateMappings(configuration);
                SignetGrantDtoAutoMapper.CreateMappings(configuration);
                PledgeBookDtoAutoMapper.CreateMappings(configuration);
                OEconomyOrganiCancelDtoAutoMapper.CreateMappings(configuration);
                #endregion

                AgencyAdminPersonDtoAutoMapper.CreateMappings(configuration);


                ParameterDtoAutoMapper.CreateMappings(configuration);


                #region 购资审核相关

                BuyQualificationDtoAutoMapper.CreateMappings(configuration);
                BuyQualificationApplyDtoAutoMapper.CreateMappings(configuration);

                #endregion

                #region 购资审核申请相关
                PurQualificationApplyDtoAutoMapper.CreateMappings(configuration);

                PurFamilyMemberDtoAutoMapper.CreateMappings(configuration);
                #endregion


                RoomVerifyPropertyDtoAutoMapper.CreateMappings(configuration);




                //房源核验v1
                RoomVerifyV1DtoAutoMapper.CreateMappings(configuration);

                //证照上传
                LicensesUploadDtoAutoMapper.CreateMappings(configuration);

                //委托代理合同摘要
                CommissionContractDigestDtoAutoMapper.CreateMappings(configuration);

                //委托代理合同正文
                CommissionContractMainBodyDtoAutoMapper.CreateMappings(configuration);

                #region 监管协议相关

                AgreementDtoAutoMapper.CreateMappings(configuration);

                #endregion

                TransactionManagementDtoAutoMapper.CreateMappings(configuration);//房产交易进度

                AttachDtoAutoMapper.CreateMappings(configuration); // 文件上传

                WaterImageDtoAutoMapper.CreateMappings(configuration);

                BarCodeDtoAutoMapper.CreateMappings(configuration);

                PdfDtoAutoMapper.CreateMappings(configuration);

                // 机构电子签章
                OrgSignetDtoAutoMapper.CreateMappings(configuration);

            });


        }

        public override void Initialize()
        {
            var thisAssembly = typeof(ApplicationContractsModule).GetAssembly();

            IocManager.RegisterAssemblyByConvention(thisAssembly);

            Configuration.Modules.AbpAutoMapper().Configurators.Add(
                // Scan the assembly for classes which inherit from AutoMapper.Profile
                cfg => cfg.AddMaps(thisAssembly)
            );

        }
    }
}